<#macro p page totalpage url='#' maxsteps=5>  
<#assign IDX="PAGE_INDEX" > 
<#if page lte 0 >  
    <#assign ipage=1> 
<#else> 
<#assign ipage=page?number>
</#if> 
<#if maxsteps lte 0 >  
    <#assign maxsteps=5>  
</#if>  
<#assign offset = ((ipage - 1) / maxsteps)?int>  
<#assign offsetLast = ((totalpage - 1) / maxsteps)?int>  
<#-- 首页 -->  
<#if ipage gt 1>  
    <a href="${url?replace(IDX,1)}">首页</a><#rt/>
<#else>  
    <span class="disabled">首页</span><#rt/>
</#if>
<#-- 前一页 -->  
<#if ipage gt 1>  
    <a href="${url?replace(IDX,ipage-1)}">前一页</a><#rt/>
<#else>  
    <span class="disabled">前一页</span><#rt/>
</#if>   
<#-- 前组-->  
<#if offset gt 0>  
    <a href="${url?replace(IDX,offset * maxsteps)}">…</a><#rt/>  
<#else>  
    <span class="disabled">…</span><#rt/>  
</#if>  
<#-- 当前组中的页号-->  
<#if (offset + 1) * maxsteps lt totalpage>  
    <#assign pagelist = (offset + 1) * maxsteps>  
<#else>  
    <#assign pagelist = totalpage>  
</#if>  
<#if ipage gt 0 && ipage lte totalpage>  
    <#list (offset * maxsteps + 1)..pagelist as num>  
        <#if ipage != num>  
            <a href="${url?replace(IDX,num)}">${num}</a><#rt/>  
        <#else>  
            <span>${num}</span><#rt/>  
        </#if>  
    </#list>  
</#if>  
<#-- 下组 -->  
<#if offset lt offsetLast>  
    <a href="${url?replace(IDX,(offset + 1) * maxsteps + 1)}">…</a><#rt/>  
<#else>  
    <span class="disabled">…</span><#rt/>  
</#if>  
<#-- 后一页 -->  
<#if ipage lt totalpage>  
    <a href="${url?replace(IDX,ipage + 1)}">下一页</a><#rt/>  
<#else>  
    <span class="disabled">下一页</span><#rt/>  
</#if> 
<#-- 尾页 -->  
<#if ipage lt totalpage>  
    <a href="${url?replace(IDX,totalpage)}">末页</a><#rt/>  
<#else>  
    <span class="disabled">末页</span> <#rt/> 
</#if>  
</#macro>  